/**
 * 
 */
package three_star_craft.uap.state;

import org.grlea.log.SimpleLogger;

import three_star_craft.uap.UapGenerator;
import three_star_craft.uap.event.EventUapConnectionReleaseCfm;

/**
 * @author w.antosiewic
 *
 */
public class UapStateDisconnectPend extends UapStateBase
{
    private static final SimpleLogger logger = new SimpleLogger(UapStateDisconnectPend.class);
    
    private static UapStateDisconnectPend instance = new UapStateDisconnectPend();
    
    /**
     * Return singleton instance of this state
     * @return an instance of this state
     */
    public static UapStateDisconnectPend getInstance()
    {
        return instance;
    }
    
    private UapStateDisconnectPend()
    {
        super("DisconnectPend");
    }

    /**
     * UapConnectionReleaseConfirm received, the generator changes state to
     * {@link UapStateIdle} and notifies listener about the change
     * 
     * @see three_star_craft.uap.UapConnectionListener
     * @see three_star_craft.uap.state.UapStateBase#handleUapConnectionReleaseConfirm(three_star_craft.uap.UapGenerator, three_star_craft.uap.event.EventUapConnectionReleaseCfm)
     */
    @Override
    public void handleUapConnectionReleaseConfirm(UapGenerator uapGenerator,
            EventUapConnectionReleaseCfm event)
    {
        logger.debug("Received UapConnectionReleaseConfirm going idle");
        uapGenerator.changeState(UapStateMap.UAP_IDLE);
        uapGenerator.getUapConnectionListener().connectionReleaseInd(uapGenerator);
    }
    
    
}
